﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BlawkayEngine.ScreenSystem
{
    public abstract class Screen
    {

        #region Constructor

        public Screen(Game oGame)
        {
            Visible = true;
            Enabled = true;
            Transition = 0.0f;
            TransitionRate = 1f / 60f;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Updates any logic within the screen
        /// </summary>
        /// <param name="oManager">The Current ScreenManager</param>
        public abstract void Update(ScreenManager oManager);

        /// <summary>
        /// Draws the Screen onto the Screen
        /// </summary>
        /// <param name="oSB">The Spritebatch Used for the screen</param>
        public abstract void Draw(ScreenManager oManager, SpriteBatch oSB);

        /// <summary>
        /// Defines what to do after this screen is fulled added
        /// </summary>
        /// <param name="oManager">The Current ScreenManager</param>
        public abstract void ActionWhenFullyAdded(ScreenManager oManager);

        /// <summary>
        /// Defines what to do after this screen is fulled removed
        /// </summary>
        /// <param name="oManager">The Current ScreenManager</param>
        public abstract void ActionWhenFullyRemoved(ScreenManager oManager);

        #endregion

        #region Properties

        /// <summary>
        /// Determines if the screen is visible or not. If set to false, it will also be disabled
        /// </summary>
        public bool Visible
        {
            get { return _Visible; }
            set
            {
                _Visible = value;
                if (_Visible == false)
                    _Enabled = false;
            }
        }

        /// <summary>
        /// Determines if the screen can update or not
        /// </summary>
        public bool Enabled
        {
            get { return _Enabled; }
            set { _Enabled = value; }
        }

        /// <summary>
        /// Determines if the screen has transitioned completely
        /// </summary>
        public bool Active
        {
            get { return _Transition >= 1.0f; }
        }

        /// <summary>
        /// The current point of transition
        /// </summary>
        public float Transition
        {
            get { return _Transition; }
            set { _Transition = value; }
        }

        /// <summary>
        /// The rate at which the screen will transition
        /// </summary>
        public float TransitionRate
        {
            get { return _TransitionRate; }
            set { _TransitionRate = value; }
        }

        #endregion

        #region Fields

        bool _Visible;
        bool _Enabled;
        float _Transition;
        float _TransitionRate;

        #endregion

    }
}
